<?php
$categories = $this->categories;
$count=count($categories);
if ($count%2!=0){
    $maxlimit=((int)$count/2)+1;

}
else {$maxlimit=((int)$count/2);}
$first_col_categories=array_slice($categories,0,$maxlimit);
$second_col_categories=array_slice($categories,$maxlimit);
?>

<b>Добавить объявление</b><br>
Выберите рубрику для вашего объявления из списка ниже.<br><br>
<table>
<tr>
<?php foreach ($categories as $key=>$category): ?>

<?php endforeach; ?>
 </tr>
    </table>

<table class="obyavku">
        <tr>
      <td>
                <?php foreach ($first_col_categories as $category): ?>
                   <a href="/ad/add/id/<?php echo $category['id'] ?>"><?php echo $this->escape($category['name']); ?></a><br>
                <?php endforeach; ?>
      </td>
      <td>
                  <?php foreach ($second_col_categories as $category): ?>
                   <a href="/ad/add/id/<?php echo $category['id'] ?>"><?php echo $this->escape($category['name']); ?></a><br>
                 <?php endforeach; ?>
      </td>
    </tr>
</table>